import Layout from '@/layout/index';
import userStore from '@/store/modules/user';
var routes = function () {
    if (userStore().isAdmin) {
        return [
            {
                path: '',
                component: Layout,
                children: [
                    {
                        path: 'index',
                        noCache: false,
                        component: () => import('@/views/index.vue'),
                        name: 'Index',
                        meta: { title: '首页', icon: 'dashboard', affix: true, noCache: false, keepAlive: true }
                    }
                ]
            },
           
            {
                path: '/learn',
                component: Layout,
                children: [
                    {
                        path: 'book',
                        component: () => import('@/views/learn/book.vue'),
                        name: 'Book',
                        meta: { title: '书籍阅读', icon: 'education', noCache: false }
                    }
                ]
            },
            {
                path: '/learn',
                component: Layout,

                children: [
                    {
                        path: 'video',
                        component: () => import('@/views/video/index.vue'),
                        name: 'Video',
                        meta: { title: '视频学习', icon: 'log', noCache: false }
                    }
                ]
            },
            {
                path: '/learn',
                component: Layout,
                hidden: true,
                children: [
                    {
                        path: 'player',
                        component: () => import('@/views/video/player.vue'),
                        name: 'Player',
                        meta: { title: '视频播放', icon: 'skill', noCache: false }
                    }
                ]
            },
            {
                path: '/learn/detail',
                component: Layout,
                hidden: true,
                children: [
                    {
                        path: ':id(\\d+)',
                        component: () => import('@/views/learn/detail.vue'),
                        name: 'LearnDetail',
                        meta: { title: '试题详细', noCache: true, activeMenu: '/learn/listen' }
                    }
                ]
            },
            {
                path: '/learn/read',
                component: Layout,
                hidden: true,
                children: [
                    {
                        path: ':id(\\d+)',
                        component: () => import('@/views/learn/read.vue'),
                        name: 'BookRead',
                        meta: { title: '图书阅读', noCache: true, activeMenu: '/learn/book' }
                    }
                ]
            },

        ]
    } else {
        return [
            {
                path: '',
                component: Layout,
                children: [
                    {
                        path: 'index',
                        noCache: false,
                        component: () => import('@/views/index.vue'),
                        name: 'Index',
                        meta: { title: '首页', icon: 'dashboard', affix: true, noCache: false, keepAlive: true }
                    }
                ]
            },
           
            {
                path: '/learn',
                component: Layout,
                children: [
                    {
                        path: 'book',
                        component: () => import('@/views/learn/book.vue'),
                        name: 'Book',
                        meta: { title: '书籍阅读', icon: 'education', noCache: false }
                    }
                ]
            },
            {
                path: '/learn',
                component: Layout,

                children: [
                    {
                        path: 'video',
                        component: () => import('@/views/video/index.vue'),
                        name: 'Video',
                        meta: { title: '视频学习', icon: 'log', noCache: false }
                    }
                ]
            },
            {
                path: '/learn',
                component: Layout,
                hidden: true,
                children: [
                    {
                        path: 'player',
                        component: () => import('@/views/video/player.vue'),
                        name: 'Player',
                        meta: { title: '视频播放', icon: 'skill', noCache: false }
                    }
                ]
            },
            {
                path: '/learn/detail',
                component: Layout,
                hidden: true,
                children: [
                    {
                        path: ':id(\\d+)',
                        component: () => import('@/views/learn/detail.vue'),
                        name: 'LearnDetail',
                        meta: { title: '试题详细', noCache: true, activeMenu: '/learn/listen' }
                    }
                ]
            },
            {
                path: '/learn/read',
                component: Layout,
                hidden: true,
                children: [
                    {
                        path: ':id(\\d+)',
                        component: () => import('@/views/learn/read.vue'),
                        name: 'BookRead',
                        meta: { title: '图书阅读', noCache: true, activeMenu: '/learn/book' }
                    }
                ]
            },

        ]
    }
    return [];

}
export default routes